import { Button, Modal, Table } from "antd";
import { useState } from "react";

export default function RankingList(props: any) {
  const { open, setOpen } = props;

  const onCancel = () => {
    setOpen(false);
  };
  const [tableConfig, setTableConfig]: any = useState({
    dataSource: [
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
    ],
    columns: [
      {
        title: "序号",
        dataIndex: "id",
        key: "id",
        align: "center",
        width: 70,
        render: (text: any, record: { id: any }, index: any) => index + 1,
      },
      {
        title: "材料名称",
        dataIndex: "dataName",
        key: "dataName",
        align: "center",
      },
      {
        title: "结算时间",
        dataIndex: "std",
        key: "std",
        align: "center",
      },
    ],
    scroll: {
      y: 400, //表格高度
      x: "100%",
    },
    pagination: false,
  });
  return (
    <Modal
      title={`排行榜`}
      width={500}
      open={open}
      onCancel={onCancel}
      maskClosable={false}
      className="rankingListModal"
      footer={[
        <Button key="back" onClick={onCancel}>
          取消
        </Button>,
      ]}
    >
      <div className="rankingListInner">
        <Table {...tableConfig} rowKey={(record) => record.id} />
      </div>
    </Modal>
  );
}
